import instance from '@/utils/request'

// 发表评论
export function createComment(data) {
    return instance.request({
        method: 'post',
        url: '/comments',
        data
    })
}

// 获取帖子评论
export function getPostComments(postId) {
    return instance.request({
        method: 'get',
        url: `/posts/${postId}/comments`
    })
}

// 获取评论回复
export function getCommentReplies(commentId) {
    return instance.request({
        method: 'get',
        url: `/comments/${commentId}/replies`
    })
}

// 更新评论
export function updateComment(commentId, data) {
    return instance.request({
        method: 'put',
        url: `/comments/${commentId}`,
        data
    })
}

// 删除评论
export function deleteComment(commentId) {
    return instance.request({
        method: 'delete',
        url: `/comments/${commentId}`
    })
}